{extend name="public/common"}
{block name="body"}
<title>基本设置</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 
	系统管理
	<span class="c-gray en">&gt;</span>
	财务设置
	<span class="c-gray en">&gt;</span>
	充值支付方案
	<span class="c-gray en">&gt;</span>
   线下支付账户
	<span class="c-gray en">&gt;</span>
	添加线下收款账户
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<!---->
<div class="page-container">
		<div id="tab-system" class="HuiTab">
				<div class="tabCon">
					<form  id="form-article-add" action="{:url('Paysetting/addOfflineAccount')}?is_add=1" method="post" enctype="multipart/form-data" class="form form-horizontal">
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-2">方案类型：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<select class="input-text" name="type" style="width:205px;" onchange="changeMethod(this)">
									<option value="wechat">微信扫码</option>
									<option value="ali">支付宝扫码</option>
									<option value="qq">QQ扫码</option>
									<option value="bank">银联转账</option>
								</select>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-2">支付类型：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<select class="input-text" name="method_id" style="width:205px;">
									{foreach $method as $key=>$val}
									<option value="{$key}">{$val}</option>
									{/foreach}
								</select>
							</div>
						</div>
						<div class="row cl">
				      <label class="form-label col-xs-4 col-sm-2" id="aa_name">微信账户昵称：</label>
				      <div class="formControls col-xs-8 col-sm-9">
				        <input type="text" name="xx_name" class="input-text" style="width:205px;"  placeholder="请输入账户昵称" id="zhnc">
				        <span ></span>
				      </div>
				    </div>
				    
				    <div class="row cl">
				      <label class="form-label col-xs-4 col-sm-2" id="bb_name">微信账户缩写：</label>
				      <div class="formControls col-xs-8 col-sm-9">
				        <input type="text" name="xx_test" class="input-text" style="width:205px;"  placeholder="请输入账户英文缩写" id="zhsx">
				        <span ></span>
				      </div>
				    </div>
				    
				    <div class="row cl">
				      <label class="form-label col-xs-4 col-sm-2">账户真实姓名：</label>
				      <div class="formControls col-xs-8 col-sm-9">
				        <input type="text" id="zsxm" name="bankren" class="input-text" style="width:205px;"  placeholder="请输入账户真实姓名" >
				        <span ></span>
				      </div>
				    </div>
					<div class="row cl">
						<label class="form-label col-xs-4 col-sm-2">方案唯一标识：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<input type="text" id="label" name="label" class="input-text" style="width:205px;" placeholder="三位字母组成">
							<p style="color: red;">编辑时设定，区分充值方案，不可重复，后期不可修改</p>
						</div>
					</div>
				    <div class="row cl three">
						<label class="form-label col-xs-4 col-sm-2">
							二维码图片：
						</label>
						<div class="formControls col-xs-8 col-sm-9">
							<span class="btn-upload form-group">
								<input class="input-text upload-url" type="text" name="xx_code" id="xx_code" readonly style="width:205px">
								<a href="javascript:void();"class="btn btn-primary radius upload-btn" >
									<i class="Hui-iconfont">&#xe642;</i>
									选择图片
								</a>
								<input type="file" id="file"  name="xx_code" class="input-file" >
							</span>
						</div>
					</div>
					
					<div class="row cl bank" style="display: none">
				      <label class="form-label col-xs-4 col-sm-2" >银行名称：</label>
				      <div class="formControls col-xs-8 col-sm-9">
				        <input type="text" name="bank_name" class="input-text" style="width:205px;">
						  <span ></span>
				      </div>
				    </div>
				    
				    <div class="row cl bank" style="display: none">
				      <label class="form-label col-xs-4 col-sm-2">银行账号：</label>
				      <div class="formControls col-xs-8 col-sm-9">
				        <input type="text" name="bankno" class="input-text" style="width:205px;">
						  <span ></span>
				      </div>
				    </div>
					<div class="row cl">
						<label class="form-label col-xs-4 col-sm-2">状态</label>
						<div class="formControls col-xs-8 col-sm-9 skin-minimal">
							<div class="radio-box" style="padding-left: 0px;">
								<input name="status" type="radio" id="sex-1" value="1" checked/>
								<label for="sex-1">开</label>
							</div>
							<div class="radio-box">
								<input name="status" type="radio" id="sex-2" value="0"/>
								<label for="sex-2">关</label>
							</div>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-4 col-sm-2">备注消息：</label>
						<div class="formControls col-xs-8 col-sm-9" style="width:250px">
							<textarea name="xx_remark" class="textarea"></textarea>
						</div>
					</div>
				    </form>
				    <div class="am-margin" style="margin-top:60px;">
				  <button style="margin-left:240px;" class="btn btn-danger radius"   id="make_sure_add" >确认添加</button>
				    <button type="button" onclick="javascript:history.go(-1);" style="margin-left:30px;" class="btn btn-primary radius">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
				  </div>
				</div>
			</div>
		</div>
	
{/block}
{block name="js"}
<script type="text/javascript" src="__SYSMET__/common.js"></script>
	<script type="text/javascript">
	$(function(){
		$("#tab-system").Huitab({
			index:0
		});
	});
	function Trim(str){ 
	  return str.replace(/(^\s*)|(\s*$)/g, ""); 
	}
	$('#zhnc').blur(function(){
		if(Trim($('#zhnc').val())==''){
			$('#zhnc').next('span').html('不能为空')
		}else{
			$('#zhnc').next('span').html('')
		}
	});
	
	$('#zhsx').blur(function(){
		if(Trim($('#zhsx').val())==''){
			$('#zhsx').next('span').html('不能为空')
		}else{
			$('#zhsx').next('span').html('')
		}
	});
	$('#zsxm').blur(function(){
		if(Trim($('#zsxm').val())==''){
			$('#zsxm').next('span').html('不能为空')
		}else{
			$('#zsxm').next('span').html('')
		}
	});
	
	$('#make_sure_add').click(function(){

		if(Trim($('#zsxm').val())==''){
			$('#zsxm').next('span').html('不能为空')
		}else{
			$('#zsxm').next('span').html('')
		}
		if(Trim($('#zhnc').val())==''){
			$('#zhnc').next('span').html('不能为空')
		}else{
			$('#zhnc').next('span').html('')
		}
		if(Trim($('#zhsx').val())==''){
			$('#zhsx').next('span').html('不能为空')
		}else{
			$('#zhsx').next('span').html('')
		}
		if(Trim($('#label').val())==''){
			$('#label').focus();
			return false;
		}
		var allform=document.getElementsByTagName('form')[0];
		var select = $("select[name='type']").find("option:selected").val();
		if( 'ali'==select || 'qq'==select || 'wechat'==select ){
			if(Trim($('#zhnc').val())!=''&&Trim($('#zsxm').val())!=''&&Trim($('#zhsx').val())!=''){
				allform.submit()
			}
		}else{
			if(Trim($('input[name="bank_name"]').val())==''){
				$('input[name="bank_name"]').next('span').html('不能为空')
			}else{
				$('input[name="bank_name"]').next('span').html('')
			}
			if(Trim($('input[name="bankno"]').val())==''){
				$('input[name="bankno"]').next('span').html('不能为空')
			}else{
				$('input[name="bankno"]').next('span').html('')
			}
			if(Trim($('#zsxm').val())!=''&&Trim($('input[name="bankno"]').val())!=''&&Trim($('input[name="bank_name"]').val())!=''){
				allform.submit()
			}
		}
	});
	function changeMethod(obj){
		var select = $(obj).find("option:selected").val();
		switch (select){
			case 'ali':
					$('.three').css('display','block');
					$('.bank').css('display','none');
					$('#aa_name').html('支付宝账户昵称：');
					$('#bb_name').html('支付宝账户缩写：');
				break;
			case 'qq':
					$('.three').css('display','block');
					$('.bank').css('display','none');
					$('#aa_name').html('QQ账户昵称：');
					$('#bb_name').html('QQ账户缩写：');
				break;
			case 'wechat':
					$('.three').css('display','block');
					$('.bank').css('display','none');
					$('#aa_name').html('微信账户昵称：');
					$('#bb_name').html('微信账户缩写：');
				break;
			case 'bank':
					$('.three').css('display','none');
					$('.bank').css('display','block');
					$('#aa_name').html('银行账户昵称：');
					$('#bb_name').html('银行账户缩写：');
				break;
		}
	}
	
</script>
{/block}
